import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
export default new Vuex.Store({
    state:{
        userId: '',
        isidtrue: '',
        gu1: '',
        islogin: false,
        permissions: [
        ]
    },
    mutations:{
        changePermissionsDown(state) {
            state.userId = '';
            state.isidtrue = false;
            state.islogin = false;
            sessionStorage.removeItem("USER_LOGINNAME");
        },
        changePermissionsUp(state,loginName) {
            state.userId = loginName;
            sessionStorage.setItem("USER_LOGINNAME",JSON.stringify(loginName));
            state.isidtrue = true;
            state.islogin = true;
        },
        // 登录和退出时 改变登录状态
        changeLog(state) {
            if(state.islogin == true) {
                state.islogin = false;
            }else {
                state.islogin = true;
            }
        }
    },
    actions:{

    }

})